package com.spring.sunflower.userinfo;

import com.spring.sunflower.base.BaseObserver;
import com.spring.sunflower.base.BasePresenter;
import com.spring.sunflower.bean.UserInfoUpdateBean;
import com.spring.sunflower.common.CommonContract;

import java.util.Map;

import io.reactivex.rxjava3.core.Observable;

/**
 * Created by Kevin on 2021/6/30<br/>
 * <p>
 * Describe:<br/>
 */
public class NickNameEditPresenter extends BasePresenter<CommonContract.NicknameEditView> {
    public NickNameEditPresenter(CommonContract.NicknameEditView baseView) {
        super(baseView);
    }
    public void updateUserInfo(Map<String, String> map) {
        Observable<UserInfoUpdateBean> observable = requestDataSource.userInfoUpdate(map);
        addDisposable(observable, new BaseObserver<UserInfoUpdateBean>(baseView) {

            @Override
            public void onSuccess(UserInfoUpdateBean bean) {
                baseView.updateSuccess();
            }

            @Override
            public void onError(int status, String msg) {
                baseView.updateFailed();
            }
        });
    }
}
